package com.usian.admin.controller;


import com.usian.admin.service.AdSensitiveService;

import com.usian.apis.admin.SensitiveControllerApi;
import com.usian.model.admin.dtos.SensitiveDto;
import com.usian.model.admin.pojos.AdSensitive;
import com.usian.model.common.dtos.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/sensitive")
@Api(value = "敏感词管理" ,tags = "sensitive", description = "敏感词管理API")
public class AdSensitiveController  implements SensitiveControllerApi {
    @Autowired
public AdSensitiveService adSensitiveService;
    @Override
    @PostMapping("/list")
    @ApiOperation(value = "查询敏感词",notes = "根据名称分页查询敏感词列表")
    @ApiImplicitParam(name = "dto",type ="SensitiveDto",value = "查询名称")
    public ResponseResult list(@RequestBody SensitiveDto dto) {
        return adSensitiveService.list(dto);
    }

    @Override
    @PostMapping("save")
    @ApiOperation(value = "新增敏感词",notes = "新增敏感词")
    @ApiImplicitParam(name = "adSensitive",type ="AdSensitive",value = "新增敏感词")
    public ResponseResult save(@RequestBody  AdSensitive adSensitive) {
        return adSensitiveService.insert(adSensitive);
    }

    @Override
    @PostMapping("update")
    @ApiOperation(value = "修改敏感词",notes = "修改敏感词")
    @ApiImplicitParam(name = "adSensitive",type ="AdSensitive",value = "修改敏感词")
    public ResponseResult update(@RequestBody  AdSensitive adSensitive) {
        return adSensitiveService.update(adSensitive);
    }



    @Override
    @GetMapping("/del/{id}")
    @ApiOperation(value = "删除敏感词",notes = "删除敏感词")
    @ApiImplicitParam(name = "id",type ="Integer",value = "删除敏感词")
    public ResponseResult deleteById(@PathVariable Integer id) {
        return adSensitiveService.deleteById(id);
    }
}
